package com.lx.spring.mvc.web;

import javax.servlet.*;
import java.io.IOException;

public class ServletFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

        //请求到达目标资源之前, 执行代码

        chain.doFilter(request, response); //执行过滤器链方法

        // 请求从目标资源返回, 执行代码
    }

    @Override
    public void destroy() {

    }
}
